/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newstuff;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *
 * @author Colin Bundervoet
 */
public class MainThread implements Runnable
{
    private ExecutorService pool;
    private ConcurrentHashMap<Integer, ServerDetails> details;
    
    
    public MainThread()
    {
        
       // TODO get this working
        pool = Executors.newFixedThreadPool(256);
    }
    
    @Override
    public void run()
    {
        while (true) {
            try {
                ServerSocket socket = new ServerSocket(5555);
                
                
                ServerSocket threadSocket = new ServerSocket(5555);
                ServerThread t;
                t = new ServerThread(socket.getLocalSocketAddress());
                
                pool.submit(t);
                
                t.run();
                
            }
            catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}
